package be.ipl.albums.domaine;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@SuppressWarnings("serial")
@Entity
@Table(name = "ALBUMS", schema = "ALBUMS")
public class Album implements Serializable {

	public enum Categorie {
		ELECTRONIC, FOLK, INDIE, JAZZ_BLUES, METAL, MISC, POP, RAP, ROCK
	}

	@EmbeddedId
	private AlbumPK pk = new AlbumPK();
	@NotNull
	@Temporal(TemporalType.DATE)
	private Calendar dateAjout;
	@NotNull
	private Categorie categorie;
	@NotNull
	@Min(0)
	@Max(320)
	private int debit;
	@NotNull
	@Min(0)
	private double taille;
	@NotNull
	private String style;

	protected Album() {
	}

	public Album(String nom, String artiste, Calendar dateAjout,
			Categorie categorie,String style, int debit, double taille) {

		this.pk = new AlbumPK(nom, artiste);
		this.dateAjout = dateAjout;
		this.categorie = categorie;
		this.debit = debit;
		this.taille = taille;
		this.style = style;
	}

	public AlbumPK getPK() {
		return pk;
	}

	public String getNom() {
		return pk.getNom();
	}

	public String getArtiste() {
		return pk.getArtiste();
	}

	public Calendar getDateDAjout() {
		return dateAjout;
	}

	public Categorie getCategorie() {
		return categorie;
	}

	public int getDebit() {
		return debit;
	}

	public double getTaille() {
		return taille;
	}

	public String getStyle() {
		return style;
	}

	public void setDebit(int debit) {
		this.debit = debit;
	}

	public void setTaille(double taille) {
		this.taille = taille;
	}

}
